<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script>
	var request;
	//var com = document.getElementsById('comm').value;
	//alert(document.getElementsById('comm').value);
	function read(group_update_id) {
		
		request = new XMLHttpRequest();
		request.open("post", "group_main_visit_comments.action?group_update_id=" + group_update_id,
				true);
		request.send();
		request.onreadystatechange = display;
	}
function all_updates(group_id) {
		
		request = new XMLHttpRequest();
		request.open("post", "group_all_updates.action?group_id=" + group_id,
				true);
		request.send();
		request.onreadystatechange = display_all_updates;
	}
	function comment(group_update_id) {
		
		request = new XMLHttpRequest();
		var com = document.getElementById(group_update_id).value;
		//alert(document.getElementsById('comm').value);
		request.open("post", "addcomment.action?group_update_id=" + group_update_id+"&addcomment="+com,
				true);
		request.send();
		request.onreadystatechange = display;
		document.getElementById(group_update_id).value = "";
	}
function post() {
		
		request = new XMLHttpRequest();
		var com = document.getElementById('group_wall_post').value;
		//alert(document.getElementsById('comm').value);
		request.open("post", "group_wall_post.action?group_wall_post="+com,
				true);
		request.send();
		request.onreadystatechange = display_post;
		document.getElementById('group_wall_post').value = "";
	}
function delete_post(group_update_id) {
	
	request = new XMLHttpRequest();
	//var com = document.getElementById('delete_comment').value;
	//alert(document.getElementsById('comm').value);
	request.open("post", "delete_post.action?group_update_id="+group_update_id,
			true);
	request.send();
	request.onreadystatechange = display_post;
	//document.getElementById('group_wall_post').value = "";
}
	function cool(group_update_id) {
		request = new XMLHttpRequest();
		request.open("post", "update_cool.action?group_update_id=" + group_update_id,
				true);
		request.send();
		//request.onreadystatechange = display;
	}
	function agree(group_update_id) {
		request = new XMLHttpRequest();
		request.open("post", "update_agree.action?group_update_id=" + group_update_id,
				true);
		request.send();
		//request.onreadystatechange = display;
	}
	function disagree(group_update_id) {
		request = new XMLHttpRequest();
		request.open("post", "update_disagree.action?group_update_id=" + group_update_id,
				true);
		request.send();
		//request.onreadystatechange = display;
	}
	function visit(group_id) {
		request = new XMLHttpRequest();
		request.open("post", "group_main_visit.action?group_id=" + group_id,
				true);
		request.send();
		//request.onreadystatechange=display;
	}
	function display() {
		document.getElementById('loader').innerHTML = request.responseText;
		//reload();
	}
	function display_post() {
		document.getElementById('post').innerHTML = request.responseText;
		//reload();
	}
	function display_all_updates() {
		document.getElementById('group_main_updates').innerHTML = request.responseText;
		//reload();
	}
	function reload() {

	}
</script>
<style type="text/css">
#loader{
	position: fixed;
	top: 105px;
}
</style>
</head>
<body>
<table>
<s:iterator value="all_updates">
	<tr>
		<td height="20px"></td>
	</tr>
	<tr>
				<td width="15px"></td>
				<td id="full" style="background-color: #F4F1F1;" colspan="1"
					width="520px">

					<table>
						<tr>
							<td height="5px"></td>
						</tr>

						<tr>
							<td width="5px"></td>
							<td>
								<table>
									<tr>
										<td width="95px"><font
											style="font-family: calibri; font-size: small; color: #29262B;"><b><s:property
														value="u_name" /></b></font></td>
										<td width="5px"></td>
										<td width="10px" style="border-left: 1px solid lightgray;"></td>
										<td width="405px"><font color="black"
											style="font-family: calibri; font-size: small;"><s:property
													value="update" /></font></td>
									</tr>
									<tr>
										<td height="5px" colspan="4"
											style="border-bottom: 1px solid lightgray;"></td>
									</tr>
									<tr>
										<td height="5px" colspan="4"></td>
									</tr>
									
									<tr>
										<td colspan="4" align="left">
											<table>
												<tr>
													<td width="4px"></td>
													<td id="comment" onclick="cool('<s:property value="group_update_id"/>')"><img src="images/cool.png">
													<!-- <a href="update_cool.action?group_update_id=<s:property value="group_update_id"/>&group_id=<s:property value="#session['group_id']"/>">
													<img src="images/cool.png"></a>  --></td>
													<td width="20px"></td>
													<td id="comment" onclick="agree('<s:property value="group_update_id"/>')"><img src="images/agree.png">
													<!-- <a href="update_agree.action?group_update_id=<s:property value="group_update_id"/>&group_id=<s:property value="#session['group_id']"/>">
													<img src="images/agree.png"></a> --></td>
													<td width="20px"></td>
													<td id="comment" onclick="disagree('<s:property value="group_update_id"/>')"><img src="images/disagree.png"> </td>
													<td width="2400px"></td>
													<td><font style="font-family: calibri; font-size: 8pt;" color="gray"><s:property value="update_time"/> </font> </td>
													<td width="20px"></td>
													<!-- <td id="delete_comment" onclick="delete('<s:property value="group_update_id"/>')"><img src="images/delete.png"> </td> -->
													<td id="delete_comment" onclick="delete_post('<s:property value="group_update_id"/>')"><font color="#F4F1F1" style="font-family: calibri; font-size: medium">&ensp;x&ensp;</font></td>
												</tr>
											</table>
										</td>
										
									</tr>
									<tr><td colspan="4" height="5px" style="border-bottom: 1px solid lightgray;"></td></tr>
									<tr>
										<td height="5px" colspan="4"></td>
									</tr>
									<tr>
										<td colspan="4">
											<table>
												<tr>
													<s:if test="comment_count>0">
														<td><table>
																<tr>

																	<td id="comment"
																		onclick="read('<s:property value="group_update_id"/>')">
																		<table>
																			<tr>
																				<td height="5px"></td>
																			</tr>
																			<tr>
																				<td width="5px"></td>
																				<td><font color="#504E4E"
																					style="font-family: calibri; font-size: 8pt;">Comments&ensp;</font></td>
																				<td height="10px" style="background-color: #535353;"><font
																					color="white"
																					style="font-family: calibri; font-size: 8pt;">&ensp;<b><s:property
																								value="comment_count" /></b>&ensp;
																				</font></td>
																				<td width="5px"></td>
																			</tr>
																			<tr>
																				<td height="5px"></td>
																			</tr>
																		</table>
																	</td>
																</tr>
																
																
															</table></td>

														<td width="20px"></td>
													</s:if>
													<s:else></s:else>
													<s:if test="cool_count>0">
														<td id="comment">
															<table>
																<tr>
																	<td height="5px"></td>
																</tr>
																<tr>
																	<td width="5px"></td>
																	<td><font color="#504E4E"
																		style="font-family: calibri; font-size: 8pt;">Cools&ensp;</font></td>
																	<td height="11px" style="background-color: #535353;"><font
																		color="white"
																		style="font-family: calibri; font-size: 8pt;">&ensp;<b><s:property
																					value="cool_count" /></b>&ensp;
																	</font></td>
																	<td width="5px"></td>
																</tr>
																<tr>
																	<td height="5px"></td>
																</tr>
															</table>
														</td>
														<td width="20px"></td>
													</s:if>
													<s:if test="agree_count>0">
														<td id="comment">
															<table>
																<tr>
																	<td height="5px"></td>
																</tr>
																<tr>
																	<td width="5px"></td>
																	<td><font color="#504E4E"
																		style="font-family: calibri; font-size: 8pt;">Agrees&ensp;</font></td>
																	<td height="11px" style="background-color: #535353;"><font
																		color="white"
																		style="font-family: calibri; font-size: 8pt;">&ensp;<b><s:property
																					value="agree_count" /></b>&ensp;
																	</font></td>
																	<td width="5px"></td>
																</tr>
																<tr>
																	<td height="5px"></td>
																</tr>
															</table>
														</td>
														
													</s:if>
													
												</tr>
												
											</table>
										</td>
										
									</tr>
									<tr><td colspan="4" height="5px" style="border-bottom: 1px solid lightgray;"></td></tr>
									<tr>
										<td height="5px" colspan="4"></td>
									</tr>
									<tr>
									<s:url action="addcomment.action" id="com">
										<s:param name="group_update_id"><s:property value="group_update_id"/></s:param>
										<!-- <s:param name="updater_id"><s:property value="updater_id"/></s:param> -->
									</s:url>
										
										
										<td style="background-color: #F4F1F1;" align="left" colspan="4">
											<table>
												<tr>
													<td width="5px"></td>
													<td>
														<input id="<s:property value="group_update_id"/>" type="text" name="addcomment" size="75"/>
													</td>
													<td width="10px"></td>
													<td id="comment" onclick="comment('<s:property value="group_update_id"/>')"><img src="images/giv_comment.png"> </td>
												</tr>
											</table>
										</td>
										
										
									</tr>	
								</table>
							</td>
							<td width="5px"></td>
						</tr>
						
						<tr>
							<td height="5px"></td>
						</tr>
						
					</table> <!-- 
				<font style="font-family: calibri; font-size: small; color: #29262B;"><b><s:property value="u_name"/></b></font>&ensp;<font style="font-family: calibri; font-size: small;"><s:property value="update"/></font>
				<br>
				&ensp;&ensp;&ensp;<font color="gray" style="font-family: calibri; font-size: 8pt;"><b><s:property value="count"/></b>&ensp;Comments</font>
				 --> <!-- 
				<table>
					<tr><td width="20px"></td><td><table width="500px" style="background-color: #EBECED;">
					<s:iterator value="group_updates">
						<tr><td height="5px"></td></tr>
						<tr><td><font style="font-family: calibri; font-size: small; color: #29262B;"><b>&ensp;<s:property value="updater_name"/></b></font>&ensp;<font style="font-family: calibri; font-size: small;"><s:property value="update"/></font></td></tr>
						<tr><td style="border-bottom: 1px solid lightgrey;" height="5px">&ensp;<font style="font-family: calibri; font-size: 8pt;"><a href="#">Cool</a>&emsp;<a href="#">Agree</a></font></td></tr>
						<tr><td height="5px"></td></tr>
						<tr><td><font style="font-family: calibri; font-size: small; color: #29262B;"><b>&ensp;<s:property value="updater_name"/></b></font>&ensp;<font style="font-family: calibri; font-size: small;"><s:property value="update"/></font></td></tr>
						<tr><td style="border-bottom: 1px solid lightgrey;" height="5px">&ensp;<font style="font-family: calibri; font-size: 8pt;"><a href="#">Cool</a>&emsp;<a href="#">Agree</a></font></td></tr>
						<!-- <tr><td height="5px" style="border-bottom: 1px solid lightgrey;"></td></tr>  -->
					<!-- 
					</s:iterator>
					</table></td></tr>
				</table>
				 -->




				</td>
			</tr>
			</s:iterator>
</table>
</body>
</html>